import request from '@/utils/request'
// 获取乡镇列表
export function townList(listquery) {
    return request({
        url: '/api/town/list',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: listquery
    })
}


//批量关联
export function settownlink(data) {
    return request({
        url: '/api/town/settownlink',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: data
    })
}

//删除关联
export function deltownlink(id){
    return request({
        url: '/api/town/deltownlink',
        method: 'post',
        data:id,
        headers: {
            "Content-Type": "multipart/form-data"
        },
    })
}

//待审核查询
export function reviewedprogresslist(listquery) {
    return request({
        url: '/api/townprogress/reviewedprogresslist',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: listquery
    })
}
//乡镇上传
export function uploadprogressziponereviewed(data,callback) {
    return request({
        url: '/api/townprogress/uploadprogressziponereviewed',
        method: 'post',
        headers: {
            "Content-Type": "multipart/form-data"
        },
        data: data,
        transformRequest: [function (formDatas) {
            return formDatas;
        }],
        onUploadProgress(progressEvent){
            if(progressEvent.lengthComputable){
                let val = (progressEvent.loaded/progressEvent.total*100).toFixed(0);
                var progress = parseInt(val);
                callback(progress)
            }
        }
    })
  }

  //乡镇通过
export function reviewedexamine(id){
    return request({
        url: '/api/townprogress/reviewedexamine',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        params:{id:id},
    })
}
//乡镇拒绝
export function setexaminemessage(data) {
    return request({
        url: '/api/townprogress/setexaminemessage',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        params:data,
    })
}

//区县现有列表
export function progresslist(listquery) {
    return request({
        url: '/api/townprogress/progresslist',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: listquery
    })
}
//村镇一体上传
export function uploadxzmostzip(data,callback) {
    return request({
        url: '/api/townprogress/uploadxzmostzip',
        method: 'post',
        headers: {
            "Content-Type": "multipart/form-data"
        },
        data: data,
        transformRequest: [function (formDatas) {
            return formDatas;
        }],
        onUploadProgress(progressEvent){
            if(progressEvent.lengthComputable){
                let val = (progressEvent.loaded/progressEvent.total*100).toFixed(0);
                var progress = parseInt(val);
                callback(progress)
            }
        }
    })
  }

    //查询年度工作总结
export function getreportlist(listquery) {
    return request({
        url: '/api/townyearsummary/getlist',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: listquery
    })
}
//上传工作总结
export function uploadreport(data) {
    return request({
        url: '/api/townyearsummary/upload',
        method: 'post',
        headers: {
            "Content-Type": "multipart/form-data"
        },
        data: data,
        transformRequest: [function (formDatas) {
            return formDatas;
        }],
        // onUploadProgress(progressEvent){
        //     if(progressEvent.lengthComputable){
        //         let val = (progressEvent.loaded/progressEvent.total*100).toFixed(0);
        //         var progress = parseInt(val);
        //         callback(progress)
        //     }
        // }
    })
  }

  //下载统计信息
export function gettownprogressexcel() {
    return request({
        url: '/api/statistical/gettownprogressexcel',
        method: 'get',
        responseType: 'blob',

    })
}
  //下载乡镇统计信息
export function geteverytownprogressexcel() {
    return request({
        url: '/api/statistical/geteverytownprogressexcel',
        method: 'get',
        responseType: 'blob',

    })
}
//excel导出
export function gettownprogresslistout() {
  return request({
      url: '/api/townprogress/progresslistout',
      method: 'post',
      responseType: 'blob',
      params:{
    }
  })
}
